<Project Sdk="Microsoft.DotNet.Helix.Sdk" DefaultTargets="Test">
  <PropertyGroup>
    <LogDirectory Condition="'$(AGENT_OS)' == 'Windows_NT'">%HELIX_WORKITEM_UPLOAD_ROOT%\</LogDirectory>
    <LogDirectory Condition="'$(AGENT_OS)' != 'Windows_NT'">%24{HELIX_WORKITEM_UPLOAD_ROOT}/</LogDirectory>

    <EnvVars Condition="'$(AGENT_OS)' == 'Windows_NT'">set RestoreAdditionalProjectSources=%HELIX_CORRELATION_PAYLOAD%\built-nugets &amp; </EnvVars>
    <EnvVars Condition="'$(AGENT_OS)' != 'Windows_NT'">export RestoreAdditionalProjectSources=$HELIX_CORRELATION_PAYLOAD/built-nugets &amp;&amp; </EnvVars>

    <Python>python3</Python>
    <HelixPreCommands Condition="'$(AGENT_OS)' != 'Windows_NT'">$(HelixPreCommands);chmod +x $HELIX_WORKITEM_PAYLOAD/SOD/SizeOnDisk</HelixPreCommands>

    <_MSBuildArgs>/p:_TrimmerDumpDependencies=true;/p:HybridGlobalization=$(hybridGlobalization);/warnaserror:NU1602,NU1604</_MSBuildArgs>
    <PublishArgs>--has-workload --readonly-dotnet --msbuild &quot;$(_MSBuildArgs)&quot; --msbuild-static AdditionalMonoLinkerOptions=%27&quot;%24(AdditionalMonoLinkerOptions) --dump-dependencies&quot;%27 --binlog $(LogDirectory)blazor_publish.binlog</PublishArgs>
    <PublishCommand>$(EnvVars) $(Python) pre.py publish $(PublishArgs)</PublishCommand>
    <!-- For non-default configurations, add the configuration to the name of the test (in the matching format), otherwise didn't add anything.
    This will ensure that PowerBI's using the test name rather than the run configuration for the data continue to work properly and defaults are connected -->
    <HybridGlobalizationPath></HybridGlobalizationPath>
    <HybridGlobalizationPath Condition="'$(hybridGlobalization)' == 'True'"> - HybridGlobalization</HybridGlobalizationPath>
    <RunConfigsString>$(HybridGlobalizationPath)</RunConfigsString>
  </PropertyGroup>

  <PropertyGroup Condition="'$(AGENT_OS)' == 'Windows_NT'">
    <ScenarioDirectory>%HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\</ScenarioDirectory>
    <BlazorMinDirectory>$(ScenarioDirectory)blazorminapp\</BlazorMinDirectory>
    <BlazorDirectory>$(ScenarioDirectory)blazor\</BlazorDirectory>
    <BlazorPizzaDirectory>$(ScenarioDirectory)blazorpizza\</BlazorPizzaDirectory>
    <BlazorMinAOTDirectory>$(ScenarioDirectory)blazorminappaot\</BlazorMinAOTDirectory>
    <BlazorAOTDirectory>$(ScenarioDirectory)blazoraot\</BlazorAOTDirectory>
    <BlazorPizzaAOTDirectory>$(ScenarioDirectory)blazorpizzaaot\</BlazorPizzaAOTDirectory>
    <BlazorLocalizedDirectory>$(ScenarioDirectory)blazorlocalized\</BlazorLocalizedDirectory>
    <PerflabTargetFrameworks>%PERFLAB_TARGET_FRAMEWORKS%</PerflabTargetFrameworks>
    <PizzaAppPubLocation>pub\wwwroot</PizzaAppPubLocation>
  </PropertyGroup>
  <PropertyGroup Condition="'$(AGENT_OS)' != 'Windows_NT'">
    <ScenarioDirectory>$HELIX_CORRELATION_PAYLOAD/performance/src/scenarios/</ScenarioDirectory>
    <BlazorMinDirectory>$(ScenarioDirectory)blazorminapp/</BlazorMinDirectory>
    <BlazorDirectory>$(ScenarioDirectory)blazor/</BlazorDirectory>
    <BlazorPizzaDirectory>$(ScenarioDirectory)blazorpizza/</BlazorPizzaDirectory>
    <BlazorMinAOTDirectory>$(ScenarioDirectory)blazorminappaot/</BlazorMinAOTDirectory>
    <BlazorAOTDirectory>$(ScenarioDirectory)blazoraot/</BlazorAOTDirectory>
    <BlazorPizzaAOTDirectory>$(ScenarioDirectory)blazorpizzaaot/</BlazorPizzaAOTDirectory>
    <BlazorLocalizedDirectory>$(ScenarioDirectory)blazorlocalized/</BlazorLocalizedDirectory>
    <PizzaAppPubLocation>pub/wwwroot</PizzaAppPubLocation>
    <PerflabTargetFrameworks>$PERFLAB_TARGET_FRAMEWORKS</PerflabTargetFrameworks>
  </PropertyGroup>

  <ItemGroup>
    <HelixCorrelationPayload Include="$(CorrelationPayloadDirectory)">
      <PayloadDirectory>%(Identity)</PayloadDirectory>
    </HelixCorrelationPayload>
  </ItemGroup>

  <ItemGroup>
    <HelixWorkItem Condition="'$(hybridGlobalization)' != 'True'" Include="SOD - Minimum Blazor Template - Publish$(RunConfigsString)">
      <PayloadDirectory>$(WorkItemDirectory)</PayloadDirectory>
      <!-- Specifying both illink dump msbuild properties in case illink version is not updated -->
      <Command>cd $(BlazorMinDirectory) &amp;&amp; $(PublishCommand) &amp;&amp; $(Python) test.py sod --scenario-name &quot;%(Identity)&quot;</Command>
    </HelixWorkItem>
    <HelixWorkItem Condition="'$(hybridGlobalization)' != 'True'" Include="SOD - Minimum Blazor Template - Publish - AOT$(RunConfigsString)">
      <PayloadDirectory>$(WorkItemDirectory)</PayloadDirectory>
      <!-- Specifying both illink dump msbuild properties in case illink version is not updated -->
      <Command>cd $(BlazorMinAOTDirectory) &amp;&amp; $(PublishCommand) &amp;&amp; $(Python) test.py sod --scenario-name &quot;%(Identity)&quot;</Command>
      <Timeout>00:30</Timeout>
    </HelixWorkItem>
    <HelixWorkItem Include="SOD - New Blazor Template - Publish$(RunConfigsString)">
        <PayloadDirectory>$(WorkItemDirectory)</PayloadDirectory>
        <Command>cd $(BlazorDirectory) &amp;&amp; $(PublishCommand) &amp;&amp; $(Python) test.py sod --scenario-name &quot;%(Identity)&quot;</Command>
        <PostCommands>$(Python) post.py --readonly-dotnet</PostCommands>
    </HelixWorkItem>
    <HelixWorkItem Include="SOD - New Blazor Template - Publish - AOT$(RunConfigsString)">
        <PayloadDirectory>$(WorkItemDirectory)</PayloadDirectory>
        <Command>cd $(BlazorAOTDirectory) &amp;&amp; $(PublishCommand) &amp;&amp; $(Python) test.py sod --scenario-name &quot;%(Identity)&quot;</Command>
        <PostCommands>$(Python) post.py --readonly-dotnet</PostCommands>
        <Timeout>00:30</Timeout>
    </HelixWorkItem>
    <HelixWorkItem Include="SOD - Pizza App - Publish$(RunConfigsString)">
      <PayloadDirectory>$(WorkItemDirectory)</PayloadDirectory>
      <!-- Specifying both illink dump msbuild properties in case illink version is not updated -->
      <Command>cd $(BlazorPizzaDirectory) &amp;&amp; $(PublishCommand) -f $(PerflabTargetFrameworks) &amp;&amp; $(Python) test.py sod --scenario-name &quot;%(Identity)&quot; --dirs $(PizzaAppPubLocation)</Command>
      <PostCommands>$(Python) post.py --readonly-dotnet</PostCommands>
    </HelixWorkItem>
    <HelixWorkItem Include="SOD - Pizza App - Publish - AOT$(RunConfigsString)">
      <PayloadDirectory>$(WorkItemDirectory)</PayloadDirectory>
      <!-- Specifying both illink dump msbuild properties in case illink version is not updated -->
      <Command>cd $(BlazorPizzaAOTDirectory) &amp;&amp; $(PublishCommand) -f $(PerflabTargetFrameworks) &amp;&amp; $(Python) test.py sod --scenario-name &quot;%(Identity)&quot; --dirs $(PizzaAppPubLocation)</Command>
      <PostCommands>$(Python) post.py --readonly-dotnet</PostCommands>
      <Timeout>1:00</Timeout>
    </HelixWorkItem>
    <HelixWorkItem Include="SOD - Localized App - Publish$(RunConfigsString)">
      <PayloadDirectory>$(WorkItemDirectory)</PayloadDirectory>
      <Command>cd $(BlazorLocalizedDirectory) &amp;&amp; $(PublishCommand) -f $(PerflabTargetFrameworks) &amp;&amp; $(Python) test.py sod --scenario-name &quot;%(Identity)&quot; --dirs $(PizzaAppPubLocation)</Command>
      <PostCommands>$(Python) post.py --readonly-dotnet</PostCommands>
      <Timeout>1:00</Timeout>
    </HelixWorkItem>
    <HelixWorkItem Include="SOD - Localized App - Publish - AOT$(RunConfigsString)">
      <_PublishArgsWithAOT>--msbuild &quot;$(_MSBuildArgs);/p:RunAOTCompilation=true&quot;</_PublishArgsWithAOT>
      <PayloadDirectory>$(WorkItemDirectory)</PayloadDirectory>
      <Command>cd $(BlazorLocalizedDirectory) &amp;&amp; $(PublishCommand) $(_PublishArgsWithAOT) -f $(PerflabTargetFrameworks) &amp;&amp; $(Python) test.py sod --scenario-name &quot;%(Identity)&quot; --dirs $(PizzaAppPubLocation)</Command>
      <PostCommands>$(Python) post.py --readonly-dotnet</PostCommands>
      <Timeout>1:00</Timeout>
    </HelixWorkItem>
  </ItemGroup>
</Project>
